# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>

pkgname=acme
# acme -V says version 0.97, but the source repo has no branches or tags
pkgver=2023.03.05
pkgrel=1
pkgdesc='Assembler for the 6502, 6510, 65c02 and 65816 processors'
arch=(loong64 x86_64)
url='https://sourceforge.net/projects/acme-crossass/'
license=(GPL)
makedepends=(setconf subversion)
conflicts=(plan9port)
source=("$pkgname::svn+https://svn.code.sf.net/p/acme-crossass/code-0/trunk#revision=r324")
b2sums=('SKIP')

prepare() {
  cd $pkgname/src
  setconf Makefile CFLAGS "$CFLAGS -w"
  setconf Makefile LIBS "$LDFLAGS -lm"
}

build() {
  make -C $pkgname/src
}

package() {
  cd $pkgname
  install -Dm755 src/acme "$pkgdir/usr/bin/acme"
  install -d "$pkgdir/usr/share/doc/acme"
  install -t "$pkgdir/usr/share/doc/acme" docs/*.txt
  # Joe syntax highlighting
  install -Dm644 contrib/joe_syntax/acme.jsf \
    "$pkgdir/usr/share/joe/syntax/acme.jsf"
  install -Dm644 contrib/joe_syntax/INSTALL \
    "$pkgdir/usr/share/doc/acme/joe.txt"
  # FS#69332
  chmod 644 "$pkgdir/usr/share/doc/acme/"*
}
